package cn.formaggie.service.impl;

import cn.formaggie.dao.StoreOutDao;
import cn.formaggie.entity.model.store.StoreOut;
import cn.formaggie.service.face.StoreOutService;
import cn.formaggie.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service("storeOutService")
public class StoreOutServiceImpl implements StoreOutService {

    @Autowired
    private StoreOutDao storeOutDao;

    @Override
    public List<StoreOut> findStoreOuts(Map<String, Object> map) {
        return storeOutDao.findStoreOuts(map);
    }

    @Override
    public Integer getStoreOutsCount(Map<String, Object> map) {
        return storeOutDao.getStoreOutsCount(map);
    }

    @Override
    public Boolean addStoreOut(StoreOut storeOut) {
        storeOut.setCode("XH"+ DateUtil.getCurrentDateStr());
        storeOut.setDate(new Date());
        return storeOutDao.addStoreOut(storeOut)>0?true:false;
    }

    @Override
    public Boolean modifyStoreOutInfo(StoreOut storeOut) {
        return storeOutDao.modifyStoreOutInfo(storeOut)>0?true:false;
    }

    @Override
    public Boolean deleteStoreOut(Integer id) {
        return storeOutDao.deleteStoreOut(id)>0?true:false;
    }
}
